package com.atguigu.servlet;

import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

public class Servlet03DoXxx extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("GET 请求调用 doGet() 方法");

        resp.setContentType("text/html;charset=UTF-8");
        resp.getWriter().write("GET 请求调用 doGet() 方法");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("POST 请求调用 doPost() 方法");

        resp.setContentType("text/html;charset=UTF-8");
        resp.getWriter().write("POST 请求调用 doPost() 方法");
    }
}
